package QC.MessageBox.beans.rcform;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Created by Andaren on 2017/4/13.
 * Used for: 融云签名表单
 */
public class RCSignForm {

    private String userId;

    private String name;

    private String portraitUri;

    public RCSignForm() {

    }

    /**
     * bean转化成表单中的各项参数拼接
     * @return
     */
    public String formatBody() {
        StringBuilder sb = new StringBuilder();
        try {
            sb.append("userId=").append(URLEncoder.encode(userId.toString(), "UTF8"))
                    .append("&name=").append(URLEncoder.encode(name.toString(), "UTF8"))
                    .append("&portraitUri=").append(URLEncoder.encode(portraitUri.toString(), "UTF8"));
        } catch (UnsupportedEncodingException en) {
            en.printStackTrace();
        }
        return sb.toString();
    }

    public String getUserId() {
        return userId;
    }

    public RCSignForm setUserId(String userId) {
        this.userId = userId;
        return this;
    }

    public String getName() {
        return name;
    }

    public RCSignForm setName(String name) {
        this.name = name;
        return this;
    }

    public String getPortraitUri() {
        return portraitUri;
    }

    public RCSignForm setPortraitUri(String portraitUri) {
        this.portraitUri = portraitUri;
        return this;
    }
}
